package content

import (
	"day12_12_homework/internal/api/request"
	"day12_12_homework/internal/models/service"
	"github.com/gin-gonic/gin"
	"net/http"
)

func ListContent(c *gin.Context) {
	var json request.ListContentRequest
	if err := c.ShouldBindJSON(&json); err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}

	contents := service.ListContents(json.IntroId)

	c.JSON(200, gin.H{
		"message": "成功",
		"data":    contents,
	})

}
